test(sketchdb): HTTP e2e for capability-miss feedback loop - #55
Merged
Merged
Conversation
Addresses TODO.md blocker #3. Complements the in-process `e2e_feedback_loop_tests` in `simple_engine.rs` (which swaps the `HotReloadStreamingConfig` directly from a mock `ControllerClient`) by adding the full HTTP round-trip: backend /api/v1/query → engine-miss → HttpControllerClient POST /api/v1/plan (mock controller) → controller POSTs canned StreamingConfig YAML back to backend /api/v1/streaming-config → backend GET /api/v1/streaming-config reflects the new plan. Two tests in `tests/capability_miss_http_e2e_tests.rs`: * `http_capability_miss_feedback_loop_closes_over_http` — measures `time_to_plan_ready` (localhost floor ~20 ms), asserts the exact agg_id the controller pushed is present on the backend, and verifies the mock controller observed the documented `{kind: "capability_miss", ...}` payload. * `http_capability_miss_repeat_query_is_idempotent_over_http` — proves a repeat query on the now-covered metric does NOT trigger a second capability-miss notify, locking down the loop's idempotency guarantee at the HTTP boundary. Scope note documented in the module preamble: OTLP data ingestion between the plan push and the repeat query is deferred to the cross-process compose harness tracked in DataCollector/TODO.md — what this file locks down is the HTTP-boundary behaviour of the feedback loop. Test count: 777 → 779.
zzylol
added a commit
that referenced
this pull request
Apr 21, 2026
Splits `CountMinSketchWithHeap` out of the plain-CMS branch in `AccuracyProfile::derive` and gives it its own bound: * per-item frequency: e/w (CMS, Cormode-Muthukrishnan 2005) * top-K retention: 1/k (Metwally et al., ICDT 2005) → reported ε = max(e/w, 1/k); δ = 1/2^d (CMS depth) → new `AccuracyKind::TopK` variant (serialised as "top_k") Heap size `k` is read from `parameters.heap_size` (or aliases `topk` / `k`), default 100. ## Why split Plain CMS has *per-key point-lookup* accuracy; CMS-with-heap further guarantees *top-K retention* — items with true frequency ≥ N·ε are guaranteed to be in the returned heap. Conflating the two bounds under `AdditiveFrequency` lost the retention guarantee, which is what users actually query the heap for. ## Tests +4 on top of #55's 5: cms_with_heap_carries_top_k_kind_and_heap_bound cms_with_heap_cms_bound_dominates_when_heap_is_generous cms_with_heap_uses_default_heap_size_100 cms_with_heap_accepts_alternative_param_names 784 → 788 lib tests green; clippy + fmt clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses TODO.md blocker #3. Complements the in-process `e2e_feedback_loop_tests` in `simple_engine.rs` by adding the full HTTP round-trip:
```
backend /api/v1/query → engine-miss →
HttpControllerClient POST /api/v1/plan (mock controller) →
controller POSTs canned StreamingConfig YAML back to
backend /api/v1/streaming-config →
backend GET /api/v1/streaming-config reflects the new plan.
```
New tests
`tests/capability_miss_http_e2e_tests.rs`:
Scope
Documented in the module preamble: OTLP data ingestion between the plan push and the repeat query is deferred to the cross-process compose harness tracked in `DataCollector/TODO.md` — what this file locks down is the HTTP-boundary behaviour of the feedback loop.
Status
777 → 779 tests. clippy + fmt clean.
🤖 Generated with Claude Code